#!/usr/bin/python
# -*- coding: utf-8 -*-

##
 # Copyright 2009 Caio Souza
 # This file is part of Rpyg.
 #
 # Rpyg is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation, either version 3 of the License, or
 # (at your option) any later version.
 #
 # Rpyg is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
 # along with Rpyg. If not, see <http://www.gnu.org/licenses/>.
 ##

'''Módulo dos tiles dos mapas.'''

class Tile:
    '''Tile de um mapa.'''
    
    def __init__ (self, image, blocked=False, depth=-1):
        '''Cria um tile a partir da imagem e valores passados.'''
        
        self._image = image
        '''Imagem do tile.'''
        
        self._blocked = bool (blocked)
        '''Booleano indicando que o tile é intransponível.'''
        
        self._depth = int (depth)
        '''Profundidade do tile.'''
        
        self.i, self.j = 0, 0
        '''Posição do tile no mapa.'''
        
    def isBlocked (self):
        '''Retorna True caso o tiles esteja bloqueado.'''
        
        return self._blocked
        
    def getDepth (self):
        '''Retorna a profundidade do tile.'''
        
        return self._depth
        
    def getSurface (self):
        '''Retona a superfície do tile.'''
        
        return self._image.getSurface ()
    
    def __len__ (self):
        return len (self._image)
    